package datastruct;

public class add {
	
	public static int add(int firstNum, int secondNum) {
	    int bitXor = 0;
	    int bitAnd = 0;
	    while (0 != secondNum) {
	        bitXor = firstNum ^ secondNum;  // 异或，提取出不同位
	        bitAnd = firstNum & secondNum;  // 与，提取进位
	        firstNum = bitXor;
	        secondNum = bitAnd << 1;
	    }
	    return firstNum;
	}
	
	public static void main(String[] args) {
		System.out.println(add(12,23));
	}

}
